/*
使用 unwrap或者expect 方法直接访问 Option 类型的内部值
但如果内部值是None，将会 panic
*/
// unwrap 默认 panic 消息
// fn main() {
//     let gift = Some("candy");
//     assert_eq!(gift.unwrap(), "candy");

//     let empty_gift: Option<&str> = None;
//     assert_eq!(empty_gift.unwrap(), "candy"); // This will panic!
// }

// expect 自定义 panic 消息
fn main() {
    let a = Some("value");
    assert_eq!(a.expect("fruits are healthy"), "value");

    let b: Option<&str> = None;
    b.expect("fruits are healthy"); // panics with `fruits are healthy`
}
